<?php
class AjaxRes extends stdClass {
    const SUCCESS = 1,
        WARNING = 2,
        ERROR = 0;

    /**
     * response type SUCCESS|WARNING|ERROR
     * @var string
     */
    public $type;

    /**
     * response message
     * @var string
     */
    public $message;

    /**
     * response system message
     * @var string
     */
    public $sysMessage;

    public static function responseJson() {
        Ming_Factory::getResponse()->setContentType('application/json');
    }

    public function toString() {
        return json_encode($this);
    }
}
